package utils

import "regexp"

var (
	regEmail  = regexp.MustCompile(`^[0-9a-z][_.0-9a-z-]{0,31}@([0-9a-z][0-9a-z-]{0,30}[0-9a-z]\.){1,4}[a-z]{2,4}$`)
	regMobile = regexp.MustCompile("^(\\+86 )?(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$")
)

// ValidateEmail 验证邮箱
func ValidateEmail(email string) bool {
	return regEmail.MatchString(email)
}

// ValidateMobile 验证中国大陆手机号
func ValidateMobile(mobileNum string) bool {
	return regMobile.MatchString(mobileNum)
}
